/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package actions;

import com.paris5.master2.guitarmaster.bean.EcomProductType;
import com.paris5.master2.guitarmaster.bean.EcomUser;
import com.paris5.master2.guitarmaster.exception.EcomException;
import com.paris5.master2.guitarmaster.exception.EcomQueryException;
import com.paris5.master2.guitarmaster.exception.EcomValidationException;
import com.paris5.master2.guitarmaster.service.ServiceConvertorRemote;
import com.paris5.master2.guitarmaster.service.ServiceCustomerRemote;
import com.paris5.master2.guitarmaster.service.ServiceProductRemote;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Leticia
 */
public class AvailableProducts extends EcomAction {

    private List<EcomProductType> products;

    public List<EcomProductType> getProducts() {
        return products;
    }

    public void setProducts(List<EcomProductType> products) {
        this.products = products;
    }

    @Override
    public String execute() throws EcomValidationException, EcomQueryException {
        ServiceProductRemote serviceProductRemote = lookupServiceProductRemote();
        products = serviceProductRemote.getAllProductType(0, 6);      
        if (getFromSession("TOTAL_PRICE")== null)
        {
            Float totalPrice = new Float(0.0);
            saveSession("TOTAL_PRICE", totalPrice);
        }
        registerRate();
        return SUCCESS;
    }
}
